Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix dialogs not working across multiple windows #18636

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

lhecker
Copy link
Member

@lhecker lhecker commented Feb 27, 2025

This can be considered "part 1" of fixing #18599: It prevents crashes (due to unhandled exceptions) by ensuring we only create 1 content dialog across all windows at a time. Sounds bad, but I tried it and it's not actually that bad in practice (it's still really gross though).

The bad news is that I don't have a "part 2", because I can't figure out what's going on:

  • Create 2 windows
  • Open the About dialog in window 1
    and right click the text
  • Close the About dialog
  • Open the About dialog in window 2
    and right click the text
  • WinUI will simply toss the focus to window 1

It appears as if context menus are permanently associated with the first window that uses them. It has nothing to do with whether a ContentDialog instance is reused (I tested that).

Validation Steps Performed

  • Open 2 windows with 2 tabs each
  • Attempt to close window 1, dialog appears ✅
  • Attempt to close window 2, dialog moves to window 2 ✅

@lhecker lhecker added Issue-Bug It either shouldn't be doing this or needs an investigation. Product-Terminal The new Windows Terminal. Priority-1 A description (P1) Area-Windowing Window frame, quake mode, tearout labels Feb 27, 2025
// If two sources call ShowDialog() simultaneously, it may happen that both enter the above loop,
// but it's crucial that only one of them continues below as only 1 dialog can be shown at a time.
// Thankfully, everything runs on the UI thread, so only 1 caller will exit the above loop at a time.
// So, if s_activeDialog is still set at this point, we must've lost the race.

Check failure

Code scanning / check-spelling

Unrecognized Spelling

[must've](#security-tab) is not a recognized word. \(unrecognized-spelling\)
@lhecker lhecker marked this pull request as draft February 27, 2025 15:31
@lhecker lhecker marked this pull request as ready for review February 27, 2025 17:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Windowing Window frame, quake mode, tearout Issue-Bug It either shouldn't be doing this or needs an investigation. Priority-1 A description (P1) Product-Terminal The new Windows Terminal.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant